/**
 * @author 徐楠
 * @date 2022/4/28 8:23
 * @version 1.0
 */

package com.xunan.likou;

public class StudentAttendanceRecordOne {
    public static void main(String[] args) {
        //String s = "PPALLP";
        String s = "LAPLLL";
        boolean b = checkRecord(s);
        System.out.println(b);
    }

    public static boolean checkRecord(String s) {
        int absent = 0;
        int late = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == 'P') {
                late = 0;
                continue;
            } else if (s.charAt(i) == 'A') {
                late = 0;
                absent++;
                continue;
            } else if (s.charAt(i) == 'L') {
                late++;
            }
            if (late >= 3) {
                return false;
            }
        }

        if (absent >= 2) {
            return false;
        }

        return true;
    }
}
